package cn.ex;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Collection;
import java.util.Set;

public class Ex9 {
    public static void main(String[] args) throws Exception{
        System.out.println("hello world");
        System.err.println("hello world");

        //建立内存图像
        BufferedImage i = new BufferedImage(300,100,BufferedImage.TYPE_INT_RGB);

        //建立画笔
        Graphics2D g = i.createGraphics();
        g.setColor(Color.WHITE);
        g.setFont(new Font("",1,30));


        g.drawString("Hello world",50,50);

        //保存图像到磁盘上，格式为jpg 文件名为a.jpg
        ImageIO.write(i,"jpg",new File("a.jpg"));




    }
}
